package cn.edu.zwu.service;

import cn.edu.zwu.dao.User;

import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class PhoneService {
    private ZoneId zoneId = ZoneId.systemDefault();
    private String companyName;
    public void setCompanyName(String companyName){
        this.companyName = companyName;
    }
    public void setZoneId(ZoneId zoneId) {
        this.zoneId = zoneId;
    }

    public String getTime() {
        return ZonedDateTime.now(this.zoneId).format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
    }

    public void sendLoginSMS(User user) {
        System.err.println(String.format("%s(sms): Hi, %s! You are logged in at %s", companyName, user.getUserName(), getTime()));
    }

    public void sendRegistrationSMS(User user) {
        System.err.println(String.format("%s(sms): Welcome, %s!",companyName, user.getUserName()));

    }
}
